// views/404.vue - Vue 3版本的404页面
<template>
  <div class="not-found">
    <div class="not-found-container">
      <div class="not-found-content">
        <h1 class="error-code">404</h1>
        <h2 class="error-message">页面未找到</h2>
        <p class="error-description">
          抱歉，您访问的页面不存在或已被移除。
        </p>
        <div class="error-actions">
          <el-button type="primary" @click="goHome" :icon="HomeFilled">返回首页</el-button>
          <el-button @click="goBack" :icon="Back">返回上页</el-button>
        </div>
      </div>
      <div class="not-found-image">
        <el-icon size="120px" color="#ddd">
          <DocumentDelete />
        </el-icon>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { HomeFilled, Back, DocumentDelete } from '@element-plus/icons-vue'

// 路由
const router = useRouter()

// 方法
const goHome = () => {
  router.push('/')
}

const goBack = () => {
  router.go(-1)
}
</script>

<style scoped>
.not-found {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 40px 20px;
}

.not-found-container {
  display: flex;
  align-items: center;
  max-width: 600px;
  text-align: center;
}

.not-found-content {
  flex: 1;
  padding-right: 40px;
}

.error-code {
  font-size: 72px;
  font-weight: bold;
  color: #409eff;
  margin: 0 0 20px 0;
}

.error-message {
  font-size: 24px;
  color: #303133;
  margin: 0 0 16px 0;
}

.error-description {
  color: #909399;
  margin: 0 0 32px 0;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.not-found-image {
  display: flex;
  justify-content: center;
  align-items: center;
}

@media (max-width: 768px) {
  .not-found-container {
    flex-direction: column;
  }

  .not-found-content {
    padding-right: 0;
    margin-bottom: 20px;
  }

  .error-code {
    font-size: 48px;
  }

  .error-actions {
    flex-direction: column;
  }
}
</style>